Repository navigation
feat(web-ui): let /compact carry the message to submit afterwards - #3751
Open
Raing5Days wants to merge 1 commit into
Open
Raing5Days wants to merge 1 commit into
Raing5Days wants to merge 1 commit into
Conversation
A manual compaction used to reject everything after the command, so the next message could only be sent once the compaction had finished and the user typed it again. `/compact <message>` now keeps the trailing text as a follow-up and submits it through the normal send path after `compact_session` settles: the desktop command returns when the maintenance turn reaches its terminal state, so the follow-up turn reads the compressed context instead of racing it. It is queued rather than steered, because the terminal bookkeeping can still be settling at that point. A manual compaction without trailing text, and every automatic compaction, submit nothing extra. Closes openBitFun#3739
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A manual
/compactused to reject every trailing argument, so the message a user wanted to send after compacting could only be typed once the maintenance turn had finished (issue #3739)./compact <message>now keeps the trailing text as a follow-up and submits it through the normal send path after the compaction settles.Fixes #3739
Type and Areas
Type: feature
Areas: web UI
Motivation / Impact
Before:
/compactcleared the composer, ran the compaction, and left the user to write their next message afterwards. Asking to compact and then continue took two submissions separated by the whole compaction.After: the trailing text is remembered, and submitted as a normal user turn once
compactSession()settles. On the desktop entry point that promise resolves when the maintenance turn reaches a terminal state, so the follow-up turn reads the compressed context instead of racing it.Behaviour details:
sendImmediately: false). An immediate send would steer the maintenance turn while its terminal bookkeeping is still settling.clearContextsOnSuccess: false): this send owns the follow-up text, and anything attached while compacting belongs to the user's next message./compactwith no trailing text, and every automatic compaction, submit nothing extra — auto compaction never goes through the composer at all./compactwithout extra arguments" guard became unreachable and was removed;chatInput.compactUsagecopy now documents the follow-up, andchatInput.compactFollowUpFailedis added in en-US / zh-CN / zh-TW.Verification
pnpm --dir src/web-ui exec vitest runequivalent vianode scripts/run-vitest.mjs runforsrc/flow_chat/utilsplus theChatInput*suites: 84 files / 813 tests passed, including the newcompactCommand.test.ts(parser) andChatInputCompactFollowUp.test.ts(composer wiring: no argument-rejecting gate, compaction awaited before the follow-up send, draft returned without clobbering newer input).ChatInput.tsxandcompactCommand.ts: no problems.pnpm run i18n:audit: passed, 0 warnings.tsc --noEmitforsrc/web-ui: no errors on the touched files. The run still reports pre-existing environment noise in my checkout (missingmaplibre-gl/@openuidev/react-langin the installed tree); nothing insrc/flow_chat.Not verified against a running desktop build — a manual compaction needs a configured model and a session with history. The ordering claim is derived from the desktop entry point's await semantics (
ConversationCoordinator::compact_session_manuallyawaits the maintenance turn's terminal result).Reviewer Notes
Remote scenarios. Remote workspace and Peer Device proxy and await
compact_sessionon the owning host, then reuse the ordinary routed send path for the follow-up; not exercised live. Detached Dispatch is the one path worth a live check: its driver returns on acceptance, not completion, so ordering relies on the target queuing the prompt turn behind the compact turn (the target already rejects a prompt on acompactturn, so the follow-up is necessarily a separate continue). Mobile web and IM bots never go through this composer and are unchanged.Overlap with #3588. That PR rewrites the same
submitCompactFromInput(an admitted/compactmust not be re-filled into the composer) for a different symptom. Whichever lands second needs a small textual merge; I can rebase on top of it if it lands first.Checklist